package com.ttloner2.dao;

import com.ttloner2.bean.Customer;

import java.sql.Connection;
import java.util.ArrayList;

/**
 * @author TTLoner
 * @date 2021/6/24 20:26
 * @description
 * 此接口用于规范针对customers表的常用操作
 */

public interface CustomerDAO {
    /*
     * @author: TTLoner
     * @time: 2021/6/24 20:29
     * @description:
     * 将customer对象添加到数据库中
     */
    int insert(Connection conn, Customer customer);

    /*
     * @author: TTLoner
     * @time: 2021/6/24 20:38
     * @description:
     *以id为检索删除
     */
    int deleteById(Connection conn, int id);

    /*
     * @author: TTLoner
     * @time: 2021/6/24 20:38
     * @description:
     *更新数据
     */
    int update(Connection conn, Customer customer);

    /*
     * @author: TTLoner
     * @time: 2021/6/24 20:38
     * @description:
     *以id为检索获取顾客信息
     */
    Customer getCustomerById(Connection conn, int id);

    /*
     * @author: TTLoner
     * @time: 2021/6/24 20:40
     * @description:
     *返回所有顾客构成的集合
     */
    ArrayList<Customer> getAll(Connection conn);

    /*
     * @author: TTLoner
     * @time: 2021/6/24 20:42
     * @description:
     *返回条目数
     */
    Long getCount(Connection conn);
}